<?php
/**
 * User: lsx
 * Date: 2017/4/21
 * Time: 11:24
 * Progress:0%
 */

namespace app\wechat\controller;


use icontroller\admin\AController;
use icontroller\admin\wechat\IWechatMenu;
use logic\admin\wechat\LWechatSetting;
use think\Db;

class WechatSetting extends AController
{
    private $logic;
    function __construct()
    {
        parent::__construct();
        $this->logic=new LWechatSetting();
    }
    public function index(){
        if($this->request->isAjax()){
            $param=array(
                'name'=>input('name'),
                'account'=>input('account'),
                'original'=>input('original'),
                'app_id'=>input('app_id'),
                'secret'=>input('secret'),
                'url'=>input('url'),
                'token'=>input('token'),
                'EncodingAESKey'=>input('EncodingAESKey'),
            );
            return $this->logic->add_data($param);
        }else{
            $data=$this->logic->index();
            if($data){
                $arr=json_decode($data,true);
                $this->assign('data',$arr);
            }
            return view();
        }

    }

}